#include "mcu.h"
#include "ports.h"
#include "motorcontrol.h"
#include "system.h"

void main()
{
    UINT8 recv[5];
    UINT8 i = 0;
    UINT8 rdata;

    system_init();

    motor_init();

    //motor_shift_gear(MOTOR_INDEX_Y,MOTOR_DIRECTION_R, MOTOR_GEAR_LS);

    //sys_timer2_install(4083);
    //sys_timer2_start();


    //sys_timer3_install(4083);
    //sys_timer3_start();

    while(1)
    {/*
        if( sys_uart_read_byte( &rdata ) )
        {
            i %= 5;
            recv[i++] = rdata;
            if( i == 4){
                UINT8 j = 0;
                for(;j<5;j++)
                    sys_uart_send_byte( recv[j]);
            }
        }
        */
/*
        if( sys_uart_read_byte( &rdata ) )
        {
            //i %= 10;
            //rdata = i++;
            sys_uart_send_byte(rdata);
        }
*/
        motor_parse_cmd();
    }
}
